package com.example.stream.filter;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author: wyb
 * @date: 2021/11/2 10:34
 * @describe:
 * @vision 1.0
 */
public class Test1 {

    public static void main(String[] args) {
        Stream<Integer> stream = Stream.of(6, 4, 6, 7, 3, 9, 8, 10, 12, 14, 14);

        Stream<Integer> newStream = stream.filter(s -> s > 5) //6 6 7 9 8 10 12 14 14
                .distinct() //6 7 9 8 10 12 14
                .skip(2) //9 8 10 12 14
                .limit(2); //9 8
        newStream.forEach(System.out::println);

        ArrayList<Student> students = new ArrayList<>();
        List<Student> studentsFilter = students.stream().
                filter(stu -> stu.getAge() > 10).collect(Collectors.toList());
    }
}
